package com.kc.web.controller.business;

import com.kc.business.domain.BizShopEnterForm;
import com.kc.business.service.IBizShopEnterService;
import com.kc.common.annotation.Log;
import com.kc.common.annotation.RepeatSubmit;
import com.kc.common.core.controller.BaseController;
import com.kc.common.core.domain.AjaxResult;
import com.kc.common.core.page.TableDataInfo;
import com.kc.common.enums.BusinessType;
import com.kc.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商家入驻
 *
 * @author zhangshuo
 */
@RestController
@RequestMapping("/business/shopEnter")
public class BizShopEnterController extends BaseController {
    @Autowired
    private IBizShopEnterService bizShopEnterFormService;

    /**
     * 获取商家入驻列表
     */
    @PreAuthorize("@ss.hasPermi('business:shopEnter:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizShopEnterForm bizShopEnterForm) {
        startPage();
        List<BizShopEnterForm> list = bizShopEnterFormService.getList(bizShopEnterForm);
        return getDataTable(list);
    }

    /**
     * 新增商家入驻
     */
    @PreAuthorize("@ss.hasPermi('business:shopEnter:add')")
    @Log(title = "商家入驻管理", businessType = BusinessType.INSERT)
    @PostMapping
    @RepeatSubmit
    public AjaxResult add(@Validated @RequestBody BizShopEnterForm bizShopEnterForm) {
        return toAjax(bizShopEnterFormService.add(bizShopEnterForm));
    }

    /**
     * 新增商家入驻
     */
    @PreAuthorize("@ss.hasPermi('business:shopEnter:approval')")
    @Log(title = "商家入驻管理", businessType = BusinessType.UPDATE)
    @PutMapping
    @RepeatSubmit
    public AjaxResult approval(@RequestBody BizShopEnterForm bizShopEnterForm) {
        return toAjax(bizShopEnterFormService.approval(bizShopEnterForm));
    }


}
